/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gaussianelimination;

/**
 *
 * @author PavelsKletnojs
 */
public class Main {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
	/* As an example */
	try{
	    ReadFile readFile;
	    
	    // 
	    readFile = new ReadFile();
	    GaussianElimination initMatrix = new GaussianElimination(readFile.matrix);
	    initMatrix.runGaussianElimination(true);
	    initMatrix.printResultVector();
	     
	    System.out.println("SET 1 % ERROR:");
	    
	    readFile = new ReadFile();
	    GaussianElimination errorMatrix = new GaussianElimination(readFile.matrix);
	    errorMatrix.set1percentError();
	    errorMatrix.runGaussianElimination(true);
	    errorMatrix.printResultVector();
	    
	    double condA;
	    System.out.println("B = " + initMatrix.euclideanNormB);  
	    System.out.println("deltaB = " + (errorMatrix.euclideanNormB - initMatrix.euclideanNormB));  
	    System.out.println("X = " + initMatrix.euclideanNormX);  
	    System.out.println("deltaX = " + (errorMatrix.euclideanNormX - initMatrix.euclideanNormX));  
	    
	    condA = ((errorMatrix.euclideanNormX - initMatrix.euclideanNormX)/initMatrix.euclideanNormX)/
		    ((errorMatrix.euclideanNormB - initMatrix.euclideanNormB)/initMatrix.euclideanNormB);
	    System.out.println("\nCond(A) = " + condA);  
	}
	catch(Exception e){
	    System.out.println("Exception: " + e);
	}
    }
}
